<?php

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['Index_Username']);
  unset($_SESSION['member_id']);
  unset($_SESSION['MM_Username_id']);
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "AdminLogin.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php 
  $MM_redirectLoginFailed = "AdminLogin.php";
  //$MM_redirectLoginSuccess="";
  if (isset($_SESSION['MM_Username'])&& isset($_SESSION['MM_UserGroup']))
  	{
      //$MM_redirectLoginSuccess = $MM_redirectLoginFailed;	
	  /*
	  echo $MM_redirectLoginFailed;
	  echo $_SESSION['MM_Username'];
	  echo "A";
	  */
    }
	else
	{
		header("Location: ".$MM_redirectLoginFailed);
		
		//echo "B";
	}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../Felix_css.css" rel="stylesheet" type="text/css" />
<title>Admin Panel</title>
<style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Geneva, sans-serif;
	font-size: 9pt;
	margin:0;
}
-->
</style></head>

<body>
<div width="100%" style="background-color:#C2CFF1;border:solid 1px #eee">
<p align="right">Welcome:<?php echo $_SESSION['MM_Username']?> <a href="<?php echo $logoutAction ?>">Log out</a></p>
<table width="1000" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
	<?php
	if($content_admin) {
		echo '<td colspan="2" align="center"><strong>Announcement</strong></td>';
	}
	if($content_admin) {
		echo '<td colspan="2" align="center"><strong>News</strong></td>';
	}
    if($super_admin) {
    	echo '<td colspan="2" align="center"><strong>Member</strong></td>';
    }
    if($content_admin) {
		echo '<td colspan="2" align="center"><strong>PetInfo</strong></td>';
	}    
    if($pay_member) {
	    echo '<td colspan="2" align="center"><strong>PetLostFound</strong></td>';
    }
    if($content_admin) {
	    echo '<td colspan="2" align="center"><strong>PetHospital</strong></td>
	    	  <td colspan="2" align="center"><strong>petsick</strong></td>';
    }
    if($pay_member) {
    	echo '<td colspan="2" align="center"><strong>HappyHome</strong></td>';
    }
    ?>
    <!--<td colspan="2" align="center"><strong>HelpManual</strong></td>-->
    <?php
    if($content_admin) {
    	echo '<td colspan="2" align="center"><strong>PetManual</strong></td>';
    	echo '<td colspan="2" align="center"><strong>PetOpus</strong></td>';
    	echo '<td colspan="2" align="center"><strong>Activity</strong></td>';
    	echo '<td colspan="2" align="center"><strong>CharitySale</strong></td>';
    }
    ?>
  </tr>
  
  <tr>
    <?php
	if($content_admin) {
	    echo '<td align="center"><a href="AddAnnounce.php">Add</a></td>
	    	  <td align="center"><a href="ShowAnnounce.php">Show</a></td>';
	}
	if($content_admin) {
	    echo '<td align="center"><a href="AddNews.php">Add</a></td>
	    	  <td align="center"><a href="ShowNews.php">Show</a></td>';
	}
	if($super_admin) {
	    echo '<td align="center"><a href="AddMember.php">Add</a></td>
	    	  <td align="center"><a href="ShowMember.php">Show</a></td>';
	}
	if($content_admin) {
	    echo '<td align="center"><a href="AddPetInfo.php">Add</a></td>
	    	  <td align="center"><a href="ShowPetInfo.php">Show</a></td>';
	}
	if($pay_member) {
	    echo '<td align="center"><a href="AddPetLostFoundInfo.php">Add</a></td>
	    	  <td align="center"><a href="ShowPetLostFoundInfo.php">Show</a></td>';
	}
	if($content_admin) {
	    echo '<td align="center"><a href="AddPetHospital.php">Add</a></td>
		      <td align="center"><a href="ShowPetHospital.php">Show</a></td>
		      <td align="center"><a href="Addpetsick.php">Add</a></td>
		      <td align="center"><a href="ShowPetSick.php">Show</a></td>';
	}
	if($pay_member) {
	    echo '<td align="center"><a href="AddHappyHome.php">Add</a></td>
	    	  <td align="center"><a href="HappyHome.php">Show</a></td>';
	}
	?>
    <!--<td align="center"><a href="AddHelpManual.php">Add</a></td>
    <td align="center"><a href="HelpManual.php">Show</a></td>-->
    <?php
    if($content_admin) {
	    echo '<td align="center"><a href="AddPetManual.php">Add</a></td>
	    	  <td align="center"><a href="PetManual.php">Show</a></td>
			  <td align="center"><a href="AddPetOpus.php">Add</a></td>
	    	  <td align="center"><a href="ShowPetOpus.php">Show</a></td>
			  <td align="center"><a href="AddActivity.php">Add</a></td>
	    	  <td align="center"><a href="ShowActivity.php">Show</a></td>
			  <td align="center"><a href="AddSaleOfWork.php">Add</a></td>
	    	  <td align="center"><a href="ShowSaleOfWork.php">Show</a></td>';
    }
    ?>
  </tr>
  <tr>
  	<?php
  	if($content_admin) {
  		echo '<td colspan="2" align="center"><strong>Newsletter</strong></td>';
  	}
  	?>
  </tr>
  <tr>
  	<?php
  	if($content_admin) {
  		echo '<td align="center"><a href="SendNewsletter.php">Send</a></td>
	    	  <td align="center"><a href="NewsletterLog.php">Log</a></td>';
  	}
  	?>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</div>
</body>
</html>